package gr.gsis.cobol.my;

import gr.gsis.cobol.data.Formatter;
import gr.gsis.cobol.spec.FieldSpec;

import java.text.DateFormat;
import java.text.SimpleDateFormat;

public class MyDateFormatter implements Formatter {

	private static DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
	
	@Override
	public Object toObject(FieldSpec spec, String value) throws Exception {
		return dateFormat.parseObject(value);
	}

	@Override
	public String toString(FieldSpec spec, Object value) {
		return dateFormat.format(value);
	}

}
